package com.jrx.anytxn.transaction.job.cmpsCrt.step;

import com.jrx.anytxn.transaction.entity.BtGuaranteeList;
import com.jrx.anytxn.transaction.mapper.ext.ExtBtGuaranteeListMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.batch.item.ItemWriter;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CmpsCrtPreWriter implements ItemWriter<BtGuaranteeList> {

    @Resource
    private ExtBtGuaranteeListMapper extBtGuaranteeListMapper;

    @Override
    public void write(List<? extends BtGuaranteeList> items) throws Exception {
        if(CollectionUtils.isNotEmpty(items)) {
            extBtGuaranteeListMapper.batchInsert((List<BtGuaranteeList>)items);
        }
    }
}
